package model;

import java.util.ArrayList;
import java.util.List;

import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;

import entidade.Conta;

@SuppressWarnings({ "serial", "rawtypes" })
public class ContaComboBoxModel extends AbstractListModel implements
		ComboBoxModel {
	private Object selectedItem;
	private List<Conta> list;

	public ContaComboBoxModel() {
		list = new ArrayList<Conta>();
	}

	public ContaComboBoxModel(List<Conta> lista) {
		this();
		list.addAll(lista);
	}

	@Override
	public int getSize() {
		return list.size();
	}

	@Override
	public Conta getElementAt(int index) {
		Conta c = list.get(index);
		return c;
	}

	@Override
	public void setSelectedItem(Object anItem) {
		selectedItem = anItem;
	}

	@Override
	public Object getSelectedItem() {
		return selectedItem;
	}

}
